package com.xyht.sca_s.student_manage_system.modules.teacher.controller;


import com.xyht.sca_s.student_manage_system.common.commonReturn.ResponseResult;
import com.xyht.sca_s.student_manage_system.common.desEncodeAndDecode.annotation.SecretBody;
import com.xyht.sca_s.student_manage_system.modules.teacher.entity.req.SmsTeacherInfoAddReq;
import com.xyht.sca_s.student_manage_system.modules.teacher.entity.req.SmsTeacherInfoDeletedReq;
import com.xyht.sca_s.student_manage_system.modules.teacher.entity.req.SmsTeacherInfoUpdateReq;
import com.xyht.sca_s.student_manage_system.modules.teacher.service.SmsTeacherInfoService;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 教师信息表 前端控制器
 * </p>
 *
 * @author XYHT
 * @since 2022-12-03
 */
@RestController
@RequestMapping("/teacher")
@SecretBody
public class SmsTeacherInfoController {

    @Resource
    private SmsTeacherInfoService smsTeacherInfoService;

    @ApiModelProperty("添加教职工")
    @PostMapping("/add")
    public ResponseResult addTeacherInfo(@RequestBody SmsTeacherInfoAddReq addReq) {
        return smsTeacherInfoService.addTeacherInfo(addReq);
    }

    @ApiModelProperty("查看教职工详情列表")
    @GetMapping("/list")
    public ResponseResult getTeacherInfoList(@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                             @RequestParam(value = "search",required = false) String search) {
        return smsTeacherInfoService.getTeacherInfoList(pageSize,pageNum,search);
    }


    @ApiModelProperty("查看教职工详情列表")
    @GetMapping("/detail")
    public ResponseResult getTeacherInfoDetail(@RequestParam(value = "tchId",required = false) String tchId) {
        return smsTeacherInfoService.getTeacherInfoDetail(tchId);
    }

    @ApiModelProperty("修改教职工详情列表")
    @PostMapping("/update")
    public ResponseResult updateTeacherInfo(@RequestBody SmsTeacherInfoUpdateReq updateReq) {
        return smsTeacherInfoService.updateTeacherInfo(updateReq);
    }

    @ApiModelProperty("删除教职工详情列表")
    @PostMapping("/deleted")
    public ResponseResult deletedTeacherInfo(@RequestBody SmsTeacherInfoDeletedReq deletedReq) {
        return smsTeacherInfoService.deletedTeacherInfo(deletedReq);
    }


}

